<template>
  <div class="">
    <van-search v-model="value" placeholder="请输入搜索关键词" />
    <button @click="gotohome">搜索</button>
    <h3>搜索记录</h3>
    <p v-for="(item, index) in $store.state.search" :key="index">
      {{ item }}
    </p>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value: "",
    };
  },
  mounted() {},
  methods: {
    gotohome() {
      this.$store.commit("setsearch", this.value);
      this.$router.push({ name: "Home", params: { value: this.value } });
    },
  },
};
</script>

<style lang="scss"></style>
